fs = require("fs");

jsConfig = [
    'jquery-1.9.1.min'
    'jquery-ui-1.10.3.custom.min'
    'bootstrap.min'
    'jquery.slimscroll.min'
    'jquery.easy-pie-chart.min'
    'jquery.sparkline.min'
    'flot/jquery.flot.min'
    'flot/jquery.flot.pie.min'
    'flot/jquery.flot.resize.min'
    'fuelux/data/fuelux.tree-sampledata'
    'fuelux/fuelux.tree.min'
    'prettify'
    'ace-elements.min'
    'ace.min'
    'bootbox.min'
    'excanvas.min'
]

cssConfig = [
    'bootstrap.min'
    'bootstrap-responsive.min'
    'font-awesome.min'
    'ace.min'
    'ace-responsive.min'
    'ace-skins.min'
]

assets_dir = Application.root_dir + "/public/assets/";
js_dir = assets_dir + "js/";
css_dir = assets_dir + "css/";
jsStr = "";
cssStr = "";

for key, value of jsConfig
    filename = js_dir + value + ".js"
    context = fs.readFileSync(filename, 'utf-8')
    jsStr += ";\n" + context


for key, value of cssConfig
    filename = css_dir + value + ".css"
    context = fs.readFileSync(filename, 'utf-8')
    cssStr += context


exports['assets_javascript.js'] = (req, res) ->
    res.write(jsStr);
    res.end();


exports['assets_style.css'] = (req, res) ->
    res.write(cssStr);
    res.end();
